package main

import (
	"fmt"
	"git.inke.cn/baiying/slove/server/silian_server_sdk/util/define"
	"github.com/jinzhu/now"
	"time"
)

func main() {
	fmt.Println(now.BeginningOfDay().AddDate(0, 0, 3).Unix())
}


func FormatTimeStr(startTime, endTime int64) string {
	year := time.Unix(startTime, 0).Format("01月02日")
	starStr := time.Unix(startTime, 0).Format("15:04")
	endStr := time.Unix(endTime, 0).Format("15:04")
	return fmt.Sprintf("%v %v-%v", year, starStr, endStr)
}

func getTodayStart() {
	t := time.Now()
	newTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
	fmt.Println(newTime.Format("2006-01-02 15:04:05"))
}

//测试日期显示为：20220829
func timeFormat() {
	//fmt.Println(time.Unix(1661743545, 0).Format(define.FormatStrV2))

	day := now.BeginningOfDay().AddDate(0, 0, -3).Format(define.FormatStrV2)
	fmt.Println(day)
}

func DurationTest() {
	a := time.Now().After(time.Unix(1665936000, 0))

	b := time.Now().Before(time.Unix(1664035199, 0))
	fmt.Println(a, b)
}

func ShiJianDuan() {
	now := time.Unix(time.Now().Unix(), 0)
	fmt.Println(now.Format(define.FormatStr))
	fmt.Println(now.Before(time.Unix(1662825600, 0)))
	fmt.Println(now.After(time.Unix(1662480000, 0)))
	//fmt.Println(now.Before(time.Unix(1662825600, 0)) && now.After(time.Unix(1662480000, 0)))
}

func Parse() {
	r, _ := time.Parse(define.FormatStr, "2022-09-10 12:22:22")
	fmt.Println(r.Format(define.FormatStr))
}
